﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Chat
{
    public partial class formChat : Form
    {

        public string ServerText
        {
            get { return textBoxServerText.Text; }
            set { textBoxServerText.Text = value; }
        }

        public TextBox ChatText
        {
            get { return textBoxChatText; }
           // set { textBoxChatText = value; }
        }

        public string SendText
        {
            get { return textBoxSendText.Text; }
            set { textBoxSendText.Text = value; }
        }

        public TextBox ClientName
        {
            get { return textBoxName; }
        }

        public int ServerPort
        {
            get { return Int32.Parse(textBoxServerPort.Text); }
            set { textBoxServerPort.Text = value.ToString(); }
        }

        public int DestPort
        {
            get { return Int32.Parse(textBoxDestPort.Text); }
            set { textBoxDestPort.Text = value.ToString(); }
        }
        public string DestIp
        {
            get { return textBoxDestIp.Text; }
            set { textBoxDestIp.Text = value.ToString(); }
        }

        public Button StartButton
        {
            get { return buttonStartServer; }
        }
        public Button StopButton
        {
            get { return buttonStopServer; }
        }
        public Button ConnectButton
        {
            get { return buttonConnectClient; }
        }
        public Button DisconnectButton
        {
            get { return buttonDisconnectClient; }
        }


        public formChat()
        {
            InitializeComponent();
        }

        public event EventHandler StartServerButtonClicked = delegate { };
        private void buttonStartServer_Click(object sender, EventArgs e)
        {
            StartServerButtonClicked(sender, e);

        }

        public event EventHandler StopServerButtonClicked = delegate { };
        private void buttonStopServer_Click(object sender, EventArgs e)
        {
            StopServerButtonClicked(sender, e);
        }

        public event EventHandler ConnectClientButtonClicked = delegate { };
        private void buttonConnectClient_Click(object sender, EventArgs e)
        {
            ConnectClientButtonClicked(sender, e);
        }
        public event EventHandler DisconnectClientButtonClicked = delegate { };
        private void buttonDisconnectClient_Click(object sender, EventArgs e)
        {
            DisconnectClientButtonClicked(sender, e);
        }

        public event EventHandler SendButtonClicked = delegate { };
        private void buttonSend_Click(object sender, EventArgs e)
        {
            SendButtonClicked(sender, e);
            textBoxSendText.Text = "";
        }

        

        public void AddChatText(string dataIn)
        {
            textBoxChatText.Text += dataIn + "\r\n";
        }
        public void AddServerText(string dataIn)
        {
            textBoxServerText.Text += dataIn + "\r\n";
        }

        private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
        {

        }

    }
}
